package com.heima.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private boolean res;
    private String msg;  //响应码 描述字符串
    private Object data; //返回的数据

    public Result(boolean t) {
    }

    public Result(Object data) {
    }


    //成功响应
    public static Result success(){
        return new Result(true);
    }
    public static Result error(){return new Result(false);}
    //把结果做为返回数据响应
    public static Result success(Object data){
        return new Result(data);
    }
    //失败响应
    public static Result error(String msg){
        return new Result(msg);
    }
}

